<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>shopCar</title>
    <link rel="stylesheet" type="text/css" href="css/index.css"/>
    <script src="lib/jquery-3.1.1.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="lib/vue.js"></script>
    <script src="app/index.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div id="app">
<div class="shopCarHeader clearfix">
    <a :href="toCommodity">返回</a>
    <span>购物车</span>
</div>
<div class="shopCarHeaderBody">
    <table border="1">
        <thead>
        <tr>
            <td>全选</td>
            <td>商品详情</td>
            <td>价格</td>
            <td>del</td>
        </tr>
        </thead>
        <tbody>
        <tr>
            <td><input type="checkbox"></td>
            <td><img :src="shopimg" alt=""><span>{{shopname}}</span></td>
            <td>¥{{shopPrice}}</td>
            <td class="del-shop">删除</td>
        </tr>
        </tbody>
    </table>
    <a :href="immToPay" class="toPay">立即支付</a>
</div>
</div>
</body>
</html>
<script>
    var commonUrl = 'http://172.30.31.254:8080/youhuishop/';
    var id = location.search.split('=')[1];
    var vm;
    $.ajax({
        url:commonUrl + 'api/shop/shoppingList',
        type:'POST',
        dataType:'json',
        data:{
            success:true
        },
        success:function (data) {
            console.log(data)
        }
    })
    $.ajax({
        url:commonUrl + 'api/goods/detail',
        type:'GET',
        dataType:'json',
        data:{
            id:id
        },
        success:function (data) {
            console.log(data);
            var shopData = data.data;
            vm = new Vue({
                el:'#app',
                data:{
                    shopimg:shopData.img,
                    shopname:shopData.name,
                    shopPrice:shopData.salePrice,
                    toCommodity:'commodity.html?id='+id,
                    immToPay:'pay.html?id='+id
                }
            })
        }
    })
</script>